home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume19 / rkive / part01 next >
Encoding:
Internet Message Format  |  1989-06-29  |  54.0 KB

  1. Subject:  v19i098:  Usenet sources archiver, Part01/04
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6.  
  7. Submitted-by: Kent Landfield <ssbell!kent>
  8. Posting-number: Volume 19, Issue 98
  9. Archive-name: rkive/part01
  10.  
  11.  
  12. rkive reads a configuration file to determine such things as:
  13.  
  14.     o where the news directory resides,
  15.     o where each newsgroup is to be archived,
  16.     o the type of archiving to be done for each newsgroup,
  17.     o the ownership and modes of the archived members,
  18.  
  19. as well as additional optional features such as:
  20.  
  21.         o which users/accounts to mail the archived member information to,
  22.     o the location and format of log files, 
  23.     o the location and format of index files,
  24.     o the compression program to use (if desired). 
  25.  
  26. It is intended that rkive be run by cron on a daily basis. In this manner,
  27. software is archived and available for retrieval from the archives on the
  28. day it reaches the machine.  It allows for the archives to be managed by
  29. the same or different people (or accounts).  It supports the building
  30. of indexes for later review or to interface to the netlib type of mail
  31. retrieval software. It also supports mailing notifications of the archiving
  32. to a specified list of users or aliases. The indexes and log file formats
  33. are specifiable by the person configuring the rkive configuration file.
  34.  
  35. This package was initially designed for archiving comp.sources.all newsgroups.
  36. It does however, support archiving of non-moderated, non-sources newsgroups.
  37.  
  38.  
  39. #! /bin/sh
  40. # This is a shell archive.  Remove anything before this line, then unpack
  41. # it by saving it into a file and typing "sh file".  To overwrite existing
  42. # files, type "sh file -c".  You can also feed this as standard input via
  43. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  44. # will see the following message at the end:
  45. #        "End of archive 1 (of 4)."
  46. # Contents:  IDEAS MANIFEST README article.h cfg.h ckconfig.1
  47. #   disp_grp.c efopen.c makedir.c patchlevel.h rename.c rkive.1 str.c
  48. #   t.cf version.c
  49. # Wrapped by kent@ssbell on Thu Jun  1 16:18:59 1989
  50. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  51. if test -f 'IDEAS' -a "${1}" != "-c" ; then 
  52.   echo shar: Will not clobber existing file \"'IDEAS'\"
  53. else
  54. echo shar: Extracting \"'IDEAS'\" \(2729 characters\)
  55. sed "s/^X//" >'IDEAS' <<'END_OF_FILE'
  56. X@(#)IDEAS    1.1 6/1/89 
  57. XWhat follows is my ideas file. It gives you a glimse into some enhancements,
  58. Xideas, problems and work in progress for rkive. This is a minimal list but
  59. Xit will grow after you send me your good ideas. :-)
  60. X
  61. X1.  If a posting should replace the current entry it is the moderator's
  62. X    responsibility to Supersedes: any invalid postings.  rkive should
  63. X    be able to handle Supersedes. Currently it does not.
  64. X
  65. X2.  Add Support For Multiple Archive Formats. 
  66. X    Have rkive link the files into a different archiving format.
  67. X    All articles should be storable in *as many* of the user-requested 
  68. X    formats as possible.  
  69. X
  70. X3.  Add internal method of numbering the articles. A *new* method of archiving.
  71. X    If the archive is moved to a different machine running news or if the
  72. X    news subsystem is restarted from scratch on the same machine, it could
  73. X    conflict with previously archived articles in archives that use 
  74. X    Article-Number, thus producing massive amounts of duplicate archive 
  75. X    files in which the only problem is the file names.  
  76. X
  77. X4.  Add a Configure.sh to handle configuration of default parameters 
  78. X    and to setup the software.
  79. X
  80. X5.  Better and more extensive documentation as well as documentation
  81. X    that explains archiving in general.
  82. X
  83. X6.  Remote archive BASEDIRs. This would allow the archive to be scattered 
  84. X    over multiple machines connected via a LAN.  With the use of rsh, rcp,
  85. X    etc., this should not be too hard.  It would require the configuration 
  86. X    file usage to be expanded so that the admin could specify the method 
  87. X    for storing.  (builtin versus rcp versus user supplied program) The 
  88. X    BASEDIR variable usage would also have to be expanded so that it 
  89. X    understood "machine:directory-path" formatting.  BEWARE of security 
  90. X    concerns here.... :-( A generic hook to user-defined storage 
  91. X    programs/libraries. I am wide open to ideas here... :-)
  92. X    
  93. X7.  An application that would allow retrieval requests from the archives 
  94. X    by reading the rkive.cf file to determine the location of the 
  95. X    newsgroup's archive and to retrieve packages by any of the archive
  96. X    methods.  This may end up using software like narc to actually do
  97. X    the unpacking for the requester. This too is just an idea now...
  98. X
  99. X8.  An application that would allow retrieval requests from the archives 
  100. X    for patches or entire packages including all posted patches. This is
  101. X    currently in progress... :-) The mythical "random downloader" :-)
  102. X
  103. XWell that's the direction I am heading... If you have *any* additional
  104. Xideas that are constructive, positive or negative (flames to /nev/dull)
  105. XI will be glad to hear from you. 
  106. X
  107. X        Good luck and Happy archiving...:-)
  108. X            kent@ssbell
  109. X
  110. END_OF_FILE
  111. if test 2729 -ne `wc -c <'IDEAS'`; then
  112.     echo shar: \"'IDEAS'\" unpacked with wrong size!
  113. fi
  114. # end of 'IDEAS'
  115. fi
  116. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  117.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  118. else
  119. echo shar: Extracting \"'MANIFEST'\" \(1985 characters\)
  120. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  121. X   File Name        Archive #    Description
  122. X-----------------------------------------------------------
  123. X IDEAS                      1    Contains future improvement ideas.
  124. X MANIFEST                   1    This shipping list
  125. X Makefile                   2    rkive make file for generating the software.
  126. X README                     1    Information posting that should be read first.
  127. X article.1                  2    Manual page for article command.
  128. X article.c                  2    Source containing article main routines.
  129. X article.h                  1    Include file for News article information.
  130. X cfg.h                      1    Include file for variable declarations.
  131. X ckconfig.1                 1    Manual page for ckconfig command.
  132. X ckconfig.c                 2    Source containing ckconfig main routine.
  133. X disp_grp.c                 1    Display newsrgoup configuration file info..
  134. X efopen.c                   1    Fopen a file with error checking.
  135. X format.c                   2    Formatting output for indexes, logs, articles.
  136. X header.c                   3    News article header reading routines.
  137. X makedir.c                  1    Make directory routines.
  138. X news_arc.c                 4    News archiving gut functions.
  139. X patchlevel.h               1    Include file containing current patchlevel.
  140. X record_arc.c               2    Routines to deal with .archived file.
  141. X rename.c                   1    Routine to rename a file.
  142. X rkive.1                    1    Manual page for the rkive command.
  143. X rkive.5                    2    Manual page for the rkive configuration file.
  144. X rkive.c                    4    Source containing rkive main routines.
  145. X rkive.cf                   3    Template configuration file.
  146. X rkive.h                    2    Include file for rkive software.
  147. X setup.c                    3    Routines to read the rkive configuration file.
  148. X str.c                      1    String manipulation routines.
  149. X t.cf                       1    Test archive config file. Not the template.
  150. X version.c                  1    Print the current version and patchlevel.
  151. END_OF_FILE
  152. if test 1985 -ne `wc -c <'MANIFEST'`; then
  153.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  154. fi
  155. # end of 'MANIFEST'
  156. fi
  157. if test -f 'README' -a "${1}" != "-c" ; then 
  158.   echo shar: Will not clobber existing file \"'README'\"
  159. else
  160. echo shar: Extracting \"'README'\" \(14704 characters\)
  161. sed "s/^X//" >'README' <<'END_OF_FILE'
  162. X
  163. X                 USENET Sources Archiver             
  164. X
  165. X                 @(#)README    1.1 6/1/89
  166. X
  167. X             Copyright (c) 1989, by Kent Landfield.
  168. X
  169. X   Permission is hereby granted to copy, distribute or otherwise 
  170. X   use any part of this package as long as you do not try to make 
  171. X   money from it or pretend that you wrote it.  The copyright 
  172. X   notice must be maintained in any copy made.
  173. X  
  174. X   If you make modifications to this software that you feel 
  175. X   increases it usefulness for the rest of the community, please 
  176. X   email the changes, enhancements, bug fixes as well as any and 
  177. X   all ideas to me. This software is going to be maintained and 
  178. X   enhanced as deemed necessary by the community.
  179. X          
  180. X            -Kent+
  181. X             uunet!ssbell!kent
  182. X  
  183. X------------------------------------------------------------------
  184. X                       DISCLAIMER
  185. X------------------------------------------------------------------
  186. XUse of this software constitutes acceptance for use in an AS IS 
  187. Xcondition. There are NO warranties with regard to this software.  
  188. XIn no event shall the author be liable for any damages whatsoever 
  189. Xarising out of or in connection with the use or performance of this 
  190. Xsoftware.  Any use of this software is at the user's own risk.
  191. X-------------------------------------------------------------------
  192. X
  193. X
  194. XWhen made, this package currently contains 3 executables:
  195. X
  196. X    o  rkive    - a USENET newsgroup archiver,
  197. X    o  article  - print formatted news article header information, and
  198. X        o  ckconfig - an rkive configuration file check program.
  199. X
  200. X
  201. XThis package was initially designed for archiving comp.sources.all newsgroups.
  202. XIt does however, support archiving of non-moderated, non-sources newsgroups.
  203. X
  204. X
  205. X                        -----
  206. X                        rkive 
  207. X                        -----
  208. X
  209. Xrkive reads a configuration file to determine such things as:
  210. X
  211. X    o where the news directory resides,
  212. X    o where each newsgroup is to be archived,
  213. X    o the type of archiving to be done for each newsgroup,
  214. X    o the ownership and modes of the archived members,
  215. X
  216. Xas well as additional optional features such as:
  217. X
  218. X        o which users/accounts to mail the archived member information to,
  219. X    o the location and format of log files, 
  220. X    o the location and format of index files,
  221. X    o the compression program to use (if desired). 
  222. X
  223. XIt is intended that rkive be run by cron on a daily basis. In this manner,
  224. Xsoftware is archived and available for retrieval from the archives on the
  225. Xday it reaches the machine.  It allows for the archives to be managed by
  226. Xthe same or different people (or accounts).  It supports the building
  227. Xof indexes for later review or to interface to the netlib type of mail
  228. Xretrieval software. It also supports mailing notifications of the archiving
  229. Xto a specified list of users or aliases. The indexes and log file formats
  230. Xare specifiable by the person configuring the rkive configuration file.
  231. X
  232. X-------------------------------------------------------------------
  233. XThe following defines are possible. Please note that the Directory
  234. XCreation defines are specified in Makefile while the rest are specified
  235. Xin rkive.h.
  236. X
  237. X***************************
  238. Xrkive.h - General Defines
  239. X***************************
  240. X
  241. X-D REDUCE_HEADERS   :   Archived article header reduction code.
  242. X    Disk space is saved by removing header lines that have no 
  243. X    further use after the article is stored in the archive.
  244. X    As currently defined, all headers *except* for From:, Newsgroups:, 
  245. X    Subject:, Message-ID: and Date are removed if this is defined.
  246. X    The list of headers to be saved can be added to or reduced by
  247. X    modifying the table "hdrs" in news_arc.c.
  248. X
  249. X-D SUBJECT_LINE     :   Specify that the local mailer has -s option
  250. X        such as /usr/bin/mailx or /usr/ucb/Mail.
  251. X
  252. X*************************************
  253. XMakefile - Directory Creation Defines
  254. X*************************************
  255. X
  256. X-D HAVE_MKDIR       : use the mkdir() function in the system library. 
  257. X    (AT&T 5.2 or earlier systems are probably out of luck..)
  258. X
  259. X-D USE_SYSMKDIR     : have rkive system off /bin/mkdir.
  260. X    (not recommended for *real* use...)
  261. X
  262. XIf you do not define either, the function makedir() will create the 
  263. Xdirectory itself. I suggest that if you do not have mkdir() in your
  264. Xsystem libraries, use the builtin if you can. *Please* verify you can
  265. Xuse it *first*.
  266. X
  267. X---------------------------
  268. XArchive Member Compression:
  269. X---------------------------
  270. XIf you wish to have your archived articles compressed you may do so by
  271. Xspecifying the disk path to the compression program as the value for
  272. XCOMPRESS in the rkive configuration file. It is important that *if* you
  273. Xuse a compression program other that "compress" or "pack" that you add
  274. Xa an entry to the compression routine table just above the function
  275. Xsuffix() in news_arc.c. Currently, this program recognizes just ".z" and 
  276. X".Z" suffixes.
  277. X
  278. X----------------
  279. XREPOST Handling:
  280. X----------------
  281. XWarning:
  282. X    Repost handling is not a configurable parameter within the 
  283. X    rkive configuration file at this time.
  284. X
  285. XADD_REPOST_SUFFIX define added.
  286. X    This define allows the administrator to configure the software to
  287. X    add "-repost" (or whatever is defined in REPOST_SUFFIX) to the
  288. X    end of all files that are marked as REPOST by the newsgroup moderator.
  289. X    The suffix is added prior to compression. This feature should only be 
  290. X    configured/exist on systems whose filename limits are greater than 14.
  291. X
  292. XMV_ORIGINAL define added.
  293. X    This define allows the administrator to configure the software to
  294. X    move the original article into a "originals" directory in the 
  295. X    problems directory. The inbound reposted article is placed into 
  296. X    the archive in the correct position.
  297. X
  298. XIf neither define is specified then the inbound article is placed into 
  299. Xthe archive in the correct position only if the initial article is not 
  300. Xin the archive.  Otherwise the reposted article is placed in the problems 
  301. Xdirectory as normal duplicate articles are now.
  302. X
  303. X-----------------
  304. XPATCHES Handling:
  305. X-----------------
  306. Xrkive supports the new Auxiliary header "Patch-To:". The Patch-To: line
  307. Xwill exist for articles that are patches to previously posted software. 
  308. XThe Patch-To: line only appears in articles that are posted, "Official", 
  309. Xpatches. The initial postings would not contain the Patch-To: auxiliary 
  310. Xheader line.
  311. X
  312. XAuxiliary Headers For Patch Postings:
  313. X
  314. X    Submitted-by: Kent Landfield <kent@ssbell.UUCP>
  315. X    Posting-number: Volume 23, Issue 14
  316. X->    Patch-To: Volume 22, Issue 122
  317. X    Archive-name: rkive/patch1
  318. X
  319. XThere are two different types of handling with regards to patches. 
  320. X
  321. X    Package     - This type of archiving of patches places the patches
  322. X                      in the same directory that the initial source was
  323. X                      posted to. This type of archiving is only available
  324. X                      to newsgroup archives that are using Archive-Name
  325. X                      archiving.
  326. X                   
  327. X    Historical  - This type of archiving patches is done by sites that 
  328. X                      want to place the the patches in the volume/issue in 
  329. X                      which the patch originally arrived.
  330. X
  331. XArchive recognizes that the Patch-To: line indicates the article is 
  332. Xa patch.  For Archive-Name archiving which has specified "Package" 
  333. Xpatches archiving in the configuration file, rkive puts the article 
  334. Xinto the directory that contained the initial posting (volume22/rkive). 
  335. XFor Archive-Name that has not specified Package archiving or for 
  336. XVolume/Issue archiving, the article would still be labeled as
  337. Xvolume23/rkive/patch01 or volume23/v23i014 respectively.
  338. X
  339. Xrkive also writes a .patchlog file in the BASEDIR for the newsgroup
  340. Xthat is used to track patches to originally posted software. The
  341. X.patchlog is going to be used for the "random software downloader :-)"
  342. Xso that complete software packages (sources and patches) can be requested
  343. Xfrom sites that do not use combined Archive-Name and Package archiving.
  344. XThe format of the .patchlog file is:
  345. X#
  346. X# Patchlog for comp.sources.whoknows
  347. X#
  348. X# Path To         Initial  Initial     Current Current 
  349. X# Patchfile       Volume   Issue       Volume  Issue
  350. X#
  351. Xbb/patch01          22     105           23    77
  352. X            or if volume issue format..
  353. Xv47i022             22     105           23    77
  354. X
  355. X-------------------------
  356. XArticle Header Reduction:
  357. X-------------------------
  358. XArticles that are stored just as they arrived on your system are potentially
  359. Xwasting disk space. Certain rfc822/rfc1036 header lines are of little use
  360. Xafter the article is archived.  If you wish to have the headers "trimmed" 
  361. Xwhen the file is archived, assure that REDUCE_HEADERS is defined. Currently 
  362. Xall header lines that are *not* either;
  363. X
  364. X    From:, Newsgroups:, Subject:, Message-ID:, and Date:
  365. X
  366. Xwill be removed. This can produce a savings of as much as 200 to 500 
  367. Xbytes per archived article.
  368. X
  369. XSee news_arc.c if you wish to add or subtract header lines to be kept.
  370. XThe modifications need to be made to the hdrstokeep table just above the
  371. Xkeep_line() function.
  372. X
  373. X---------
  374. XSecurity:
  375. X---------
  376. Xrkive sets the ownership, group and modes on the archived members according
  377. Xto the information specified in the configuration file. Currently though,
  378. Xrkive uses the default umask for creating the log and index files.
  379. X
  380. Xrkive will not archive files outside of the BASEDIR specified in the 
  381. Xconfiguration file so a "prankster" can not do nasty things to your
  382. Xsystem files by having an Archive-name line like:
  383. X    Archive-name: ../../../../../../etc/passwd
  384. X
  385. XIt will also not overwrite duplicate files. They are stored underneath
  386. Xthe problems directory specified in the configuration file. The admin 
  387. Xis alerted to the fact and it then becomes a manual cleanup problem.
  388. X
  389. X                        -------
  390. X                        article 
  391. X                        -------
  392. X
  393. XArticle allows you to view the article headers in much the same manner
  394. Xthat you use a printf statement.  This was initially done for debugging
  395. Xpurposes but I quickly found that it was extremely useful in dealing
  396. Xwith news articles in general. It works great in shell scripts to view
  397. Xarticles that need to be read.... Also super for perusing the archives
  398. Xdirectly and generating indexes to the archives in *many* different 
  399. Xways...:-)
  400. X
  401. X                        --------
  402. X                        ckconfig 
  403. X                        --------
  404. X
  405. XThis program is used by the admin to verify just how rkive will 
  406. Xinterpret the variable specifications in an archive configuration
  407. Xfile. If you have problems, it will bomb out when it encounters
  408. Xthe problem. Not real smart but it does the job..
  409. X
  410. X------------------------------------------------------------------------
  411. XThis software set was developed under an archiving model similar to
  412. Xthat maintained currently on uunet. It was intended that the archiving
  413. Xfacilities were more of a "site" facility and not an individuals
  414. Xfacility. (That is unless the individual owned the site :-)). I have
  415. Xnot tried to use rkive for maintaining a private (many on a single machine)
  416. Xarchive. There does not seem to be any reason why it would not work. It
  417. Xjust hasn't been done. rkive will accept an rkive.cf file specified on the
  418. Xcommand line so it would be possible for an individual to have their own
  419. Xmini archive directory structure. This is not recommended if the site is
  420. Xdoing archiving since the software will store multiple copies thus wasting
  421. Xmore disk space than it is worth.  Aside from that, if someone does try it,
  422. Xlet me know how it turns out. :-) :-)
  423. X------------------------------------------------------------------------
  424. XCredits:
  425. X--------
  426. XI have to give credit to where credit is do.
  427. X
  428. XI used the code in header.c of the News 2.11 as the basis of ideas for
  429. Xdealing with the article headers. The code I have written is not the same
  430. Xbut most of the concepts and some of the flow control resulted from reviewing
  431. Xhow it was "suppose to be done". (rfcs only go so far.. :-)) For that I
  432. Xthank rick adams and the authors of news for the excellent code to study
  433. Xfrom.. :-)
  434. X
  435. XI would also like to thank my beta testers for the headaches of dealing
  436. Xwith me, with forcing different ideas on me at a time when I was "almost"
  437. Xwilling to listen :-) and for the many different "full redistribution of 
  438. Xsources" everytime I had a new version. Specifically I want to thank 
  439. Xeric@amperif (Eric Johnson) and denny@mcmi (Dennis Page) for putting up 
  440. Xwith me.. :-)
  441. X------------------------------------------------------------------------
  442. X
  443. XPlease read all the directions below before you proceed any 
  444. Xfurther, and then follow them carefully.  
  445. X
  446. X                    --------------
  447. X                     Installation
  448. X                    --------------
  449. X
  450. XThis package uses Doug Gwyn's directory access routines posted in
  451. Xcomp.sources.unix/volume9 (with the bug fix as well). You may need
  452. Xto get a copy if you don't already have one and your system does 
  453. Xnot support POSIX Compatible directory access routines.
  454. X
  455. X1)  Take the time to format and read the man pages prior to continuing.
  456. X        make man | less/pg/more
  457. X
  458. X2)  Review/modify rkive.h to make sure system defines are correct.  
  459. X
  460. X3)  Determine the method for directory creation and edit the Makefile
  461. X    accordingly.
  462. X
  463. X4)  make
  464. X
  465. X    This will attempt to make the software in the current directory.
  466. X
  467. X5)  Put rkive, ckconfig, and article into a public directory 
  468. X    (normally /usr/local/bin), and put a template of the rkive
  469. X    configuration file  (if one does not exist) into a library directory
  470. X    (normally as /usr/local/lib/rkive.cf).  Place the man pages in the
  471. X    appropriate man directories for your site.
  472. X
  473. X
  474. X6)  I have set up an account for the source archives.  This is not really 
  475. X    necessary but is a personal preference. Archive needs to be run as 
  476. X    root *if* you do not have the mkdir () and wish to use the builtin
  477. X    since it needs to use mknod() to create directories.
  478. X
  479. X    ---x--x--x  1 root archive    43048 Apr  9 16:38 /usr/local/bin/rkive
  480. X    ---x--x--x  1 src  archive    14836 Apr  9 16:38 /usr/local/bin/article
  481. X    ---x--x--x  1 src  archive    27448 Apr  9 16:38 /usr/local/bin/ckconfig
  482. X    -r--r--r--  1 src  archive     6173 Apr  9 16:40 /usr/local/lib/rkive.cf
  483. X
  484. X7)  Re-read the manual entry for rkive.1 and rkive.5.
  485. X
  486. X8)  Modify the template rkive configuration file to reflect the local
  487. X    archive conditions. ckconfig should be used in order to check the
  488. X    information that you have just entered/modified in the rkive.cf file. 
  489. X
  490. X9)  VERY IMPORTANT! If you have a problem, there's someone else out there 
  491. X    who either has had or will have the same problem.  Please send all 
  492. X    patches, ideas, etc to kent@ssbell (or uunet!ssbell!kent) so that I 
  493. X    can continue to improve the functionality and portability of this 
  494. X    package. 
  495. END_OF_FILE
  496. if test 14704 -ne `wc -c <'README'`; then
  497.     echo shar: \"'README'\" unpacked with wrong size!
  498. fi
  499. # end of 'README'
  500. fi
  501. if test -f 'article.h' -a "${1}" != "-c" ; then 
  502.   echo shar: Will not clobber existing file \"'article.h'\"
  503. else
  504. echo shar: Extracting \"'article.h'\" \(4444 characters\)
  505. sed "s/^X//" >'article.h' <<'END_OF_FILE'
  506. X/*
  507. X**     @(#)article.h    1.1 6/1/89 
  508. X**
  509. X*/
  510. X
  511. X#define BUFLEN    128    /* standard buffer size                     */
  512. X#define LBUFLEN  1024    /* big buffer size                          */
  513. X#define PATHLEN   512    /* length of longest source string          */
  514. X#define DATELEN    64    /* length of longest allowed date string    */
  515. X#define TRUE        1    
  516. X#define FALSE       0    
  517. X
  518. X/*
  519. X** Format output called from defines 
  520. X*/
  521. X#define ARCHIVE     1
  522. X#define ARTICLE     2
  523. X
  524. X/*
  525. X** Line type defines -  index uses
  526. X*/
  527. X
  528. X#define FROM            1
  529. X#define PATH            2
  530. X#define NEWSGROUP       3
  531. X#define SUBJECT         4
  532. X#define MSG_ID            5
  533. X#define REPLY_TO        6
  534. X#define REFERENCES      7
  535. X#define DATE            8
  536. X#define EXPIRE          9
  537. X#define CONTROL        10
  538. X#define SENDER         11
  539. X#define FOLLOWUP_TO    12
  540. X#define DISTRIBUTION   13
  541. X#define ORGANIZATION   14
  542. X#define NUMLINES       15
  543. X#define KEYWORDS       16
  544. X#define SUMMARY        17
  545. X#define APPROVED       18
  546. X#define SUPERSEDES     19
  547. X#define XREF           20
  548. X#define POSTING_NUMBER 21
  549. X#define SUBMITTED_BY   22
  550. X#define ARCH_NAME      23
  551. X#define ARTICLEID      24
  552. X#define PATCH_TO       25
  553. X#define OTHER          99
  554. X
  555. X/* 
  556. X** article header storage structure
  557. X*/
  558. X
  559. Xstruct    header {
  560. X    char    from[BUFLEN];         /* From:                 */
  561. X    char    path[PATHLEN];        /* Path:                 */
  562. X    char    nbuf[LBUFLEN];        /* Newsgroups:           */
  563. X    char    subject[BUFLEN];      /* Subject:              */
  564. X    char    ident[BUFLEN];        /* Message-ID:           */
  565. X    char    replyto[BUFLEN];      /* Reply-To:             */
  566. X    char    references[BUFLEN];   /* References:           */
  567. X    char    subdate[DATELEN];     /* Date: (submission)    */
  568. X    time_t  subtime;              /* subdate in secs       */
  569. X    char    expdate[DATELEN];     /* Expires:              */
  570. X    char    ctlmsg[PATHLEN];      /* Control:              */
  571. X    char    sender[BUFLEN];       /* Sender:               */
  572. X    char    followup_to[BUFLEN];  /* Followup-to:          */
  573. X    char    distribution[BUFLEN]; /* Distribution:         */
  574. X    char    organization[BUFLEN]; /* Organization:         */
  575. X    char    numlines[8];          /* Lines:                */
  576. X    int     intnumlines;          /* Integer version       */
  577. X    char    keywords[BUFLEN];     /* Keywords:             */
  578. X    char    summary[BUFLEN];      /* Summary:              */
  579. X    char    approved[BUFLEN];     /* Approved:             */
  580. X    char    xref[BUFLEN];         /* Xref:                 */
  581. X    char    supersedes[BUFLEN];   /* Supersedes:           */
  582. X    char    submitted_by[BUFLEN]; /* Submitted_by:         */
  583. X    char    posting_num[BUFLEN];  /* Posting-number:       */
  584. X    char    archive_name[BUFLEN]; /* Archive-name:         */
  585. X    char    patch_to[BUFLEN];     /* Patch-To:             */
  586. X};
  587. X
  588. X/*
  589. X** Type of archive file defines
  590. X*/
  591. X#define NORMAL         0
  592. X#define INFORMATIONAL  1
  593. X#define PATCH          2
  594. X
  595. X/* 
  596. X** archive information structure
  597. X*/
  598. X
  599. Xstruct archive_rec {
  600. X    char newsgroup[LBUFLEN];      /* news group            */
  601. X    char newsarticle[LBUFLEN];    /* news article          */
  602. X    char filename[BUFLEN];        /* destination file      */
  603. X    int  volume;                  /* storage volume        */
  604. X    int  issue;                   /* article issue number  */
  605. X    int  rectype;                 /* type of article       */
  606. X                                  /*   NORMAL article =  0 */
  607. X                                  /*   INFORMATIONAL  =  1 */
  608. X                                  /*   PATCH          =  2 */
  609. X    int  repost;                  /* REPOST'ed article ?   */
  610. X    int  patch_volume;            /* Initially posted      */
  611. X                                  /*   storage volume      */
  612. X    int  patch_issue;             /* Initially posted      */
  613. X                                  /*   article issue number*/
  614. X    char description[BUFLEN];     /* information           */
  615. X    char author_name[BUFLEN];     /* author full name      */
  616. X    char author_signon[BUFLEN];   /* author sign on        */
  617. X};
  618. X
  619. Xextern FILE *logfp;
  620. X
  621. X#ifndef ARTICLE_DEF
  622. X#define ARTICLE_DEF 1
  623. X    struct archive_rec article;
  624. X    struct header header;
  625. X    char s[BUFSIZ];
  626. X    int debug;
  627. X    int verbose;
  628. X#else
  629. X    extern char s[];
  630. X    extern int debug;
  631. X    extern int verbose;
  632. X    extern struct archive_rec article;
  633. X    extern struct header header;
  634. X#endif /* ARTICLE_DEF */
  635. END_OF_FILE
  636. if test 4444 -ne `wc -c <'article.h'`; then
  637.     echo shar: \"'article.h'\" unpacked with wrong size!
  638. fi
  639. # end of 'article.h'
  640. fi
  641. if test -f 'cfg.h' -a "${1}" != "-c" ; then 
  642.   echo shar: Will not clobber existing file \"'cfg.h'\"
  643. else
  644. echo shar: Extracting \"'cfg.h'\" \(709 characters\)
  645. sed "s/^X//" >'cfg.h' <<'END_OF_FILE'
  646. X/*
  647. X**     @(#)cfg.h    1.1 6/1/89 
  648. X*/
  649. X#include "rkive.h"
  650. X
  651. X#ifndef CFG
  652. X#define CFG 1
  653. X    int num;
  654. X    char *progname;
  655. X    struct group_archive group[NUM_NEWSGROUPS];
  656. X    FILE *errfp;
  657. X    FILE *logfp;
  658. X    int fill_in_defaults;
  659. X    extern char *config_file;
  660. X    extern char problems_dir[];
  661. X    extern char spooldir[];
  662. X    extern char compress[];
  663. X    extern char log[];
  664. X    extern char log_format[];
  665. X    extern char index[];
  666. X    extern char index_format[];
  667. X    extern char mail[];
  668. X    extern int default_type;
  669. X    extern int default_patch_type;
  670. X    extern int default_owner;
  671. X    extern int default_group;
  672. X    extern int default_modes;
  673. X#else
  674. X    extern int num;
  675. X    extern char *progname;
  676. X    extern struct group_archive group[];
  677. X    extern FILE *errfp;
  678. X    extern FILE *logfp;
  679. X#endif /* CFG */
  680. END_OF_FILE
  681. if test 709 -ne `wc -c <'cfg.h'`; then
  682.     echo shar: \"'cfg.h'\" unpacked with wrong size!
  683. fi
  684. # end of 'cfg.h'
  685. fi
  686. if test -f 'ckconfig.1' -a "${1}" != "-c" ; then 
  687.   echo shar: Will not clobber existing file \"'ckconfig.1'\"
  688. else
  689. echo shar: Extracting \"'ckconfig.1'\" \(3110 characters\)
  690. sed "s/^X//" >'ckconfig.1' <<'END_OF_FILE'
  691. X'br "@(#)ckconfig.1    1.1 6/1/89"
  692. X.TH CKCONFIG 1
  693. X.SH NAME
  694. Xckconfig \- check the rkive configuration file setup
  695. X.SH SYNOPSIS
  696. X.B ckconfig
  697. X[ -V ] [ -f config_file ]
  698. X.SH DESCRIPTION
  699. X.I ckconfig
  700. Xis used to verify a new or modified USENET archiver configuration file.
  701. X.PP
  702. XThe output is displayed as is shown in the sample below.
  703. X.nf
  704. X
  705. X    Configuration Check for /usr/local/lib/rkive.cf
  706. X
  707. X            Global Defines
  708. X
  709. XNews Directory:      /usr/spool/news
  710. XProblems Directory:  /usenet/problems
  711. XGlobal Logfile:      /usenet/archive.log
  712. XGlobal Index:        NO INDEXING
  713. XLogfile Format:      %B %a\t%T
  714. XIndex Format:        NOT SPECIFIED
  715. XMail Results To:     kent,rick
  716. X
  717. XThe following values are used if the administrator has
  718. Xnot set a value for a necessary configuration item(s).
  719. X
  720. XArchive Type:    Volume-Issue
  721. XPatches Type:    Historical
  722. XDefault Owner:   10 <src>
  723. XDefault Group:   11 <archive>
  724. XDefault Modes:   444
  725. XCompression:     NO COMPRESSION
  726. X
  727. X        Newsgroup Archive Configuration
  728. X
  729. Xcomp.sources.unix newsgroup archived to /usenet/unix
  730. X    Archive Type:   Archive-Name
  731. X    Patches Type:   Package
  732. X    Owner:          10 <src>
  733. X    Group:          11 <archive>
  734. X    File Modes:     444
  735. X    Logfile:        /usenet/unix/log
  736. X    Index File:     /usenet/unix/index
  737. X    Logfile Format: NOT SPECIFIED   (DEFAULT)
  738. X    Index Format:   %B %a %T
  739. X    Mail Results:   NO ONE          (DEFAULT)
  740. X    Compression:    NO COMPRESSION  (*NO* DEFAULT)
  741. X
  742. X
  743. Xcomp.sources.x newsgroup archived to /usenet/x
  744. X    Archive Type:   Volume-Issue
  745. X    Patches Type:   Historical
  746. X    Owner:          10 <src>
  747. X    Group:          11 <archive>
  748. X    File Modes:     444
  749. X    Logfile:        /usenet/x/log
  750. X    Index File:     /usenet/x/index
  751. X    Logfile Format: NOT SPECIFIED   (DEFAULT)
  752. X    Index Format:   %B %a %T
  753. X    Mail Results:   mark, chris
  754. X    Compression:    /usr/local/bin/compress
  755. X
  756. X.nr
  757. X
  758. X.PP
  759. XThe "(DEFAULT)" indicates that the global value will be used since
  760. Xthe administrator did not specify a value specific to that newsgroup.
  761. XThe "(*NO* DEFAULT)" indicates that there is no global value to
  762. Xbe substituted. In the entry for comp.sources.unix displayed above,
  763. Xthere was no compression routine specified in the newsgroups entry
  764. Xand there is no globally defined compression routine.
  765. X.SH OPTIONS
  766. X.IP "-V"
  767. XPrint the version number and patchlevel of the current executable.
  768. X.IP "-f config_file"
  769. XExecute ckconfig using the specified config_file as the input file to 
  770. Xbe checked.
  771. X.IP "-g"
  772. XThis option allows the global default values to be displayed in the 
  773. Xnewsgroup variables when there is nothing specified in the newsgroup 
  774. Xentry of the configuration file. If the above example had been run
  775. Xusing this option, the output would have been:
  776. X.nf
  777. X
  778. Xcomp.sources.unix newsgroup archived to /usenet/unix
  779. X    Archive Type:   Archive-Name
  780. X    Patches Type:   Package
  781. X    Owner:          10 <src>
  782. X    Group:          11 <archive>
  783. X    File Modes:     444
  784. X    Logfile:        /usenet/unix/log
  785. X    Index File:     /usenet/unix/index
  786. X    Logfile Format: %B %a\t%T
  787. X    Index Format:   %B %a %T
  788. X    Mail Results:   kent,rick
  789. X    Compression:    NO COMPRESSION  (*NO* DEFAULT)
  790. X
  791. X.nr
  792. X.LP
  793. X.SH FILES
  794. X/usr/local/lib/rkive.cf
  795. X.SH "SEE ALSO"
  796. Xarticle(1), rkive(1), rkive(5)
  797. X.SH BUGS
  798. XNone known.
  799. END_OF_FILE
  800. if test 3110 -ne `wc -c <'ckconfig.1'`; then
  801.     echo shar: \"'ckconfig.1'\" unpacked with wrong size!
  802. fi
  803. # end of 'ckconfig.1'
  804. fi
  805. if test -f 'disp_grp.c' -a "${1}" != "-c" ; then 
  806.   echo shar: Will not clobber existing file \"'disp_grp.c'\"
  807. else
  808. echo shar: Extracting \"'disp_grp.c'\" \(3810 characters\)
  809. sed "s/^X//" >'disp_grp.c' <<'END_OF_FILE'
  810. X/*
  811. X**
  812. X** This software is Copyright (c) 1989 by Kent Landfield.
  813. X**
  814. X** Permission is hereby granted to copy, distribute or otherwise 
  815. X** use any part of this package as long as you do not try to make 
  816. X** money from it or pretend that you wrote it.  This copyright 
  817. X** notice must be maintained in any copy made.
  818. X**
  819. X**
  820. X**  History:
  821. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  822. X**                                                               
  823. X*/
  824. X#ifndef lint
  825. Xstatic char SID[] = "@(#)disp_grp.c    1.1 6/1/89";
  826. X#endif
  827. X
  828. X#include <sys/types.h>
  829. X#include <dirent.h>
  830. X#include <stdio.h>
  831. X#include <pwd.h>
  832. X#include <grp.h>
  833. X#include "cfg.h"
  834. X
  835. Xextern fill_in_defaults;
  836. Xextern FILE *logfp;
  837. X
  838. Xstruct passwd *pw;
  839. Xstruct passwd *getpwuid();
  840. Xstruct group *gr;
  841. Xstruct group *getgrgid();
  842. X
  843. Xchar *what_to_print(ng_val, gbl_val, str)
  844. Xchar *ng_val, *gbl_val, *str;
  845. X{
  846. X    static char rtbuf[50];
  847. X
  848. X    /*
  849. X    ** If the newsgroup variable has been 
  850. X    ** specified, return that value.
  851. X    */
  852. X    if (*(ng_val)) 
  853. X        return (ng_val);
  854. X
  855. X    /*
  856. X    ** If no global value has been specified
  857. X    ** so that there is no default, build the
  858. X    ** display string and return.
  859. X    */
  860. X    if (!*gbl_val) {
  861. X        (void) sprintf(rtbuf,"%-15s (*NO* DEFAULT)", str);
  862. X        return (rtbuf);
  863. X    }
  864. X
  865. X    /*
  866. X    ** Ok, here we have a global value.
  867. X    ** Check if the user has requested to display global default
  868. X    ** values in variables that are not specifically assigned 
  869. X    ** for the newsgroup...
  870. X    */
  871. X    if (fill_in_defaults)
  872. X        return (gbl_val);
  873. X
  874. X    (void) sprintf(rtbuf,"%-15s (DEFAULT)", str);
  875. X    return (rtbuf);
  876. X}
  877. X
  878. X
  879. Xdisplay_group_info(ng)
  880. Xstruct group_archive *ng;
  881. X{
  882. X    if (!*ng->location)
  883. X       (void) fprintf(logfp,"\007\007%s does not have an archived location\n",
  884. X                  ng->ng_name);
  885. X    else
  886. X       (void) fprintf(logfp,"%s newsgroup archived to %s\n", 
  887. X                  ng->ng_name, ng->location);
  888. X
  889. X    (void) fprintf(logfp,"\tArchive Type:   %s\n",
  890. X                  ng->type == ARCHIVE_NAME ? "Archive-Name" : 
  891. X                  ng->type == VOLUME_ISSUE ? "Volume-Issue" :
  892. X                                             "Article-Number"); 
  893. X    (void) fprintf(logfp,"\tPatches Type:   %s\n", 
  894. X                  ng->patch_type == PACKAGE ? "Package" : "Historical");
  895. X
  896. X    /* 
  897. X    ** The getpwuid() and getgrgid() calls have been previously made
  898. X    ** thus verifying the entries exist. No real reason to check if
  899. X    ** calls fail. If they do, something a lot bigger than this program
  900. X    ** is hosed...
  901. X    */
  902. X    pw = getpwuid(ng->owner);
  903. X    (void) fprintf(logfp,"\tOwner:          %d <%s>\n", 
  904. X                  ng->owner, pw->pw_name);
  905. X    gr = getgrgid(ng->group);
  906. X    (void) fprintf(logfp,"\tGroup:          %d <%s>\n", 
  907. X                  ng->group, gr->gr_name);
  908. X
  909. X    (void) fprintf(logfp,"\tFile Modes:     %o\n", ng->modes);
  910. X    (void) fprintf(logfp,"\tLogfile:        %s\n", 
  911. X               what_to_print(ng->logfile, log, "NO LOGGING"));
  912. X    (void) fprintf(logfp,"\tIndex File:     %s\n", 
  913. X               what_to_print(ng->index, index, "NO INDEXING"));
  914. X    (void) fprintf(logfp,"\tLogfile Format: %s\n", 
  915. X               what_to_print(ng->logformat, log_format, "NOT SPECIFIED"));
  916. X    (void) fprintf(logfp,"\tIndex Format:   %s\n", 
  917. X               what_to_print(ng->indformat, index_format, "NOT SPECIFIED"));
  918. X    (void) fprintf(logfp,"\tMail Results:   %s\n", 
  919. X               what_to_print(ng->mail_list, mail, "NO ONE"));
  920. X    (void) fprintf(logfp,"\tCompression:    %s\n", 
  921. X               what_to_print(ng->compress, compress, "NO COMPRESSION"));
  922. X
  923. X    if ((ng->patch_type == PACKAGE) && (ng->type != ARCHIVE_NAME)) {
  924. X        (void) fprintf(logfp,"\nWARNING: Package Patches archiving is only\n");
  925. X        (void) fprintf(logfp,"         used with Archive-Name archiving.\n");
  926. X    }
  927. X}
  928. X
  929. END_OF_FILE
  930. if test 3810 -ne `wc -c <'disp_grp.c'`; then
  931.     echo shar: \"'disp_grp.c'\" unpacked with wrong size!
  932. fi
  933. # end of 'disp_grp.c'
  934. fi
  935. if test -f 'efopen.c' -a "${1}" != "-c" ; then 
  936.   echo shar: Will not clobber existing file \"'efopen.c'\"
  937. else
  938. echo shar: Extracting \"'efopen.c'\" \(828 characters\)
  939. sed "s/^X//" >'efopen.c' <<'END_OF_FILE'
  940. X/*
  941. X**
  942. X** This software is Copyright (c) 1989 by Kent Landfield.
  943. X**
  944. X** Permission is hereby granted to copy, distribute or otherwise 
  945. X** use any part of this package as long as you do not try to make 
  946. X** money from it or pretend that you wrote it.  This copyright 
  947. X** notice must be maintained in any copy made.
  948. X**
  949. X**
  950. X**  History:
  951. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  952. X**                                                               
  953. X*/
  954. X#ifndef lint
  955. Xstatic char SID[] = "@(#)efopen.c    1.1 6/1/89";
  956. X#endif
  957. X
  958. X#include <stdio.h>
  959. X
  960. Xextern FILE *errfp;
  961. X
  962. XFILE *efopen(file,mode)       
  963. Xchar *file, *mode;
  964. X{
  965. X     FILE *fp;
  966. X     FILE *fopen();
  967. X     void exit();
  968. X
  969. X     if ((fp = fopen (file, mode)) == NULL) {
  970. X         (void) fprintf (errfp, "Can't open file %s\n", file);
  971. X         exit(1);
  972. X     }
  973. X     return (fp);
  974. X}
  975. END_OF_FILE
  976. if test 828 -ne `wc -c <'efopen.c'`; then
  977.     echo shar: \"'efopen.c'\" unpacked with wrong size!
  978. fi
  979. # end of 'efopen.c'
  980. fi
  981. if test -f 'makedir.c' -a "${1}" != "-c" ; then 
  982.   echo shar: Will not clobber existing file \"'makedir.c'\"
  983. else
  984. echo shar: Extracting \"'makedir.c'\" \(3647 characters\)
  985. sed "s/^X//" >'makedir.c' <<'END_OF_FILE'
  986. X/*
  987. X**
  988. X** This software is Copyright (c) 1989 by Kent Landfield.
  989. X**
  990. X** Permission is hereby granted to copy, distribute or otherwise 
  991. X** use any part of this package as long as you do not try to make 
  992. X** money from it or pretend that you wrote it.  This copyright 
  993. X** notice must be maintained in any copy made.
  994. X**
  995. X**
  996. X**  History:
  997. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  998. X**                                                               
  999. X*/
  1000. X#ifndef lint
  1001. Xstatic char SID[] = "@(#)makedir.c    1.1 6/1/89";
  1002. X#endif
  1003. X
  1004. X#include <sys/types.h>
  1005. X#include <sys/stat.h>
  1006. X#include <stdio.h>
  1007. X#include <dirent.h>
  1008. X#include "rkive.h"
  1009. X
  1010. Xextern char *progname;
  1011. X
  1012. Xextern int verbose;
  1013. Xextern int test;
  1014. X
  1015. Xextern FILE *errfp;
  1016. Xextern FILE *logfp;
  1017. X
  1018. Xint makedir(dirpath, mode, owner_id, group_id)
  1019. X    char *dirpath;
  1020. X    int mode;
  1021. X    int owner_id;
  1022. X    int group_id;
  1023. X{
  1024. X#ifndef HAVE_MKDIR
  1025. X# ifndef USE_SYSMKDIR
  1026. X
  1027. X    char *strcat();
  1028. X    char *strncpy();
  1029. X    char *strcpy();
  1030. X
  1031. X    register i;
  1032. X    register slen = 0;
  1033. X
  1034. X    char parent[MAXNAMLEN];
  1035. X
  1036. X#endif /* USE_SYSMKDIR */
  1037. X
  1038. X    char crnt_dir[MAXNAMLEN];
  1039. X
  1040. X#endif /* HAVE_MKDIR */
  1041. X    
  1042. X    if ((strlen(dirpath) == 0) || (dirpath[0] == NULL)) {
  1043. X        (void) fprintf(errfp,"%s: cannot make %s\n", progname,dirpath);
  1044. X        return(-1);
  1045. X    }
  1046. X
  1047. X    if (verbose) {
  1048. X        (void) fprintf(logfp,"making\t<%s>\n",dirpath);
  1049. X        if (test) 
  1050. X            return(0);
  1051. X    }
  1052. X
  1053. X#ifdef HAVE_MKDIR
  1054. X
  1055. X    /*
  1056. X    ** mkdir function supplied in system library.
  1057. X    */
  1058. X
  1059. X    if (mkdir(dirpath,mode) != 0)
  1060. X        return(-1);
  1061. X
  1062. X    (void) chown(dirpath, owner_id, group_id);
  1063. X
  1064. X#else
  1065. X# ifdef USE_SYSMKDIR
  1066. X
  1067. X    /* 
  1068. X    ** Use the system mkdir executable.. why?
  1069. X    */
  1070. X
  1071. X    /* build up command */
  1072. X
  1073. X    (void) sprintf(crnt_dir, "/bin/mkdir %s", dirpath);
  1074. X
  1075. X    if (system(crnt_dir) != 0)
  1076. X        return(-1);
  1077. X
  1078. X    (void) chown(dirpath, owner_id, group_id);
  1079. X    (void) chmod(dirpath, mode);
  1080. X
  1081. X# else
  1082. X
  1083. X    /*
  1084. X    ** Builtin mkdir function in use ...
  1085. X    **
  1086. X    ** Save the parent path
  1087. X    */
  1088. X
  1089. X    i = 0;
  1090. X    parent[0] = '\0';
  1091. X
  1092. X    while (dirpath[i]) {
  1093. X        if (dirpath[i] == '/')
  1094. X            slen = i + 1;
  1095. X        ++i;
  1096. X    }
  1097. X
  1098. X    if (slen)    /* Is there a parent string to save ? */
  1099. X        (void) strncpy(parent, dirpath, slen);
  1100. X
  1101. X    (void) strcpy(parent+slen, ".");
  1102. X
  1103. X    /* Does the parent directory exist and is it writable ? */
  1104. X
  1105. X    if (access(parent, 02)) {
  1106. X        (void) fprintf(errfp,"%s: cannot access %s\n", progname,parent);
  1107. X        return(-1);
  1108. X    }
  1109. X
  1110. X    /* make the actual directory file */
  1111. X
  1112. X    if ((mknod(dirpath, S_IFDIR | mode, 0)) < 0) {
  1113. X        (void)fprintf(errfp,"%s: can't make directory %s\n",progname,dirpath);
  1114. X        return(-1);
  1115. X    }
  1116. X
  1117. X    (void) chown(dirpath, owner_id, group_id);
  1118. X
  1119. X    /* need to create the "." directory entry */
  1120. X
  1121. X    (void) strcpy(crnt_dir, dirpath);
  1122. X    (void) strcat(crnt_dir, "/.");
  1123. X
  1124. X    if ((link(dirpath, crnt_dir)) < 0) {
  1125. X        /* 
  1126. X        ** Could not link the  directory to it's "." entry.
  1127. X        ** Clean up and return.
  1128. X        */
  1129. X        (void) unlink(dirpath);
  1130. X        (void) fprintf(errfp, "%s: cannot link [%s]\n", progname,crnt_dir);
  1131. X        return(-1);
  1132. X    }
  1133. X
  1134. X    /* need to create the "." directory entry */
  1135. X
  1136. X    (void) strcat(crnt_dir, ".");
  1137. X
  1138. X    if ((link(parent, crnt_dir)) < 0) {
  1139. X        /* 
  1140. X        ** Could not link the parent directory to the ".." entry.
  1141. X        ** Clean up and return.
  1142. X        */
  1143. X        crnt_dir[strlen(crnt_dir)] = '\0';
  1144. X        (void) unlink(crnt_dir);
  1145. X        (void) unlink(dirpath);
  1146. X        (void) fprintf(errfp, "%s: cannot link [%s]\n",progname,crnt_dir);
  1147. X        return(-1);
  1148. X    }
  1149. X#endif /* USE_SYSMKDIR */
  1150. X#endif /* HAVE_MKDIR */
  1151. X    return(0); 
  1152. X}
  1153. END_OF_FILE
  1154. if test 3647 -ne `wc -c <'makedir.c'`; then
  1155.     echo shar: \"'makedir.c'\" unpacked with wrong size!
  1156. fi
  1157. # end of 'makedir.c'
  1158. fi
  1159. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1160.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1161. else
  1162. echo shar: Extracting \"'patchlevel.h'\" \(61 characters\)
  1163. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1164. X/*
  1165. X**    @(#)patchlevel.h    1.1 6/1/89
  1166. X*/
  1167. X#define PATCHLEVEL 0
  1168. END_OF_FILE
  1169. if test 61 -ne `wc -c <'patchlevel.h'`; then
  1170.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1171. fi
  1172. # end of 'patchlevel.h'
  1173. fi
  1174. if test -f 'rename.c' -a "${1}" != "-c" ; then 
  1175.   echo shar: Will not clobber existing file \"'rename.c'\"
  1176. else
  1177. echo shar: Extracting \"'rename.c'\" \(1055 characters\)
  1178. sed "s/^X//" >'rename.c' <<'END_OF_FILE'
  1179. X/*    
  1180. X**
  1181. X** This software is Copyright (c) 1989 by Kent Landfield.
  1182. X**
  1183. X** Permission is hereby granted to copy, distribute or otherwise 
  1184. X** use any part of this package as long as you do not try to make 
  1185. X** money from it or pretend that you wrote it.  This copyright 
  1186. X** notice must be maintained in any copy made.
  1187. X**
  1188. X**
  1189. X**  History:
  1190. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  1191. X**                                                               
  1192. X*/
  1193. X#ifndef lint
  1194. Xstatic char SID[] = "@(#)rename.c    1.1 6/1/89";
  1195. X#endif
  1196. X
  1197. X#include <stdio.h>
  1198. X
  1199. Xextern FILE *errfp;
  1200. X
  1201. X/*
  1202. X**    rename(sfn, dfn)
  1203. X**    rename char *sfn to char *dfn
  1204. X*/
  1205. X
  1206. Xint rename(sfn, dfn)
  1207. Xchar *sfn;        /* source file name      */
  1208. Xchar *dfn;        /* destination file name */
  1209. X{
  1210. X    int rcd;
  1211. X
  1212. X    (void) unlink(dfn);       /* remove the destination file */
  1213. X
  1214. X    if ((rcd = link(sfn, dfn)) == -1) 
  1215. X        (void) fprintf(errfp, "Can't link %s to %s\n", sfn, dfn);
  1216. X    else if ((rcd = unlink(sfn)) == -1) 
  1217. X        (void) fprintf(errfp, "Can't unlink %s\n", sfn);
  1218. X    return(rcd);
  1219. X}
  1220. X
  1221. END_OF_FILE
  1222. if test 1055 -ne `wc -c <'rename.c'`; then
  1223.     echo shar: \"'rename.c'\" unpacked with wrong size!
  1224. fi
  1225. # end of 'rename.c'
  1226. fi
  1227. if test -f 'rkive.1' -a "${1}" != "-c" ; then 
  1228.   echo shar: Will not clobber existing file \"'rkive.1'\"
  1229. else
  1230. echo shar: Extracting \"'rkive.1'\" \(4927 characters\)
  1231. sed "s/^X//" >'rkive.1' <<'END_OF_FILE'
  1232. X'br "@(#)rkive.1    1.1 6/1/89"
  1233. X.TH RKIVE 1
  1234. X.SH NAME
  1235. Xrkive \- archive USENET source groups
  1236. X.SH SYNOPSIS
  1237. X.B rkive
  1238. X[ -dstuvV ] [ -n newsgroup ]
  1239. X.SH DESCRIPTION
  1240. X.I rkive
  1241. Xis used to archive the USENET sources groups to an alternate
  1242. Xlocation as specified in an rkive configuration file. Archives can
  1243. Xbe maintained in one of three ways:
  1244. X.PP 
  1245. X.I Archive-Name -
  1246. XThe moderators of most sources groups assign an official Archive-Name 
  1247. Xto each article that gets submitted to the net. In this manner, each file
  1248. Xhas a "new-login" or "elm/part06" type of format. For multi-part postings, 
  1249. Xa subdirectory is created (as indicated in the elm example) to hold the 
  1250. Xseparate "parts". This format is used by many large archive sites because 
  1251. Xit is easier for retrieval via mail request software such as netlib and 
  1252. Xthe filenames give hints as to what the software is.
  1253. X.PP 
  1254. X.I Volume-Issue -
  1255. XSoftware sent via most moderated groups have an assigned Volume and Issue 
  1256. Xnumber. This allows the moderators to track and reference the individual 
  1257. Xitems that have been posted to the group. Each individual article is given 
  1258. Xan "Issue" number. The Issues are grouped together into a "Volume". There 
  1259. Xare roughly 100 articles in each Volume but this is an arbitrary split 
  1260. Xtotally up to the moderator.  This format is extremely useful when the 
  1261. Xsoftware archives are cataloged. It makes searching of the files quicker
  1262. Xand verification of complete volumes easier. This archive format is 
  1263. Xrecommended for any site that will be doing massive searches of the 
  1264. Xindividual volumes since it keeps the quadratic nature of directory searches 
  1265. Xfrom making your life miserable. 
  1266. X.PP 
  1267. X.I Article Number -
  1268. XThe news software stores the articles locally by naming the news article 
  1269. Xby a number generated on every site. The Article Number ordering is unique 
  1270. Xto each site. If an Article Number archive is requested (or required by the 
  1271. Xnewsgroup), the news article file is copied to the directory specified in 
  1272. Xthe archive configuration file. The name of the archived article will match
  1273. Xthe original name generated by the news software.
  1274. X.PP
  1275. XBy means of a configuration file (see rkive(5)), the archive administrator
  1276. Xis able to control how archiving is performed. The administrator can specify
  1277. Xon a per newsgroup basis:
  1278. X.nf
  1279. X
  1280. X    o The type of the archiving, such as Volume-Issue
  1281. X      Archive-Name, or Article Number archiving,
  1282. X    o Where the newsgroup archive is to be stored on disk,
  1283. X    o The location of log file for the newsgroup,
  1284. X    o The format of the logfile records,
  1285. X    o The location of index file for the newsgroup,
  1286. X    o The format of the index file records,
  1287. X    o A list of users to be sent mail when an article is archived,
  1288. X    o The owner/group and modes of each archived member, and
  1289. X    o Whether the archived members should be compressed or not.
  1290. X
  1291. X.nr
  1292. X.PP
  1293. XThis program is normally started from cron on a daily basis. Archiving
  1294. Xof newly arrived software is only done once for each file. If rkive 
  1295. Xis started daily, the posted sources are placed into the sources archive 
  1296. Xthe first day the software arrives on the machine instead of having to 
  1297. Xwait for expire -a to run.
  1298. X.PP
  1299. X.SH OPTIONS
  1300. X.IP "-d" 6
  1301. XTurn on debugging output. This is more "verbose" than the verbose 
  1302. Xoption below.  (-v assumed)
  1303. X.IP "-f config_file"
  1304. XThis option allows the user to specify the file to be used as the 
  1305. Xrkive configuration file.
  1306. X.IP "-g"
  1307. XThis option allows the global default values to be displayed in the 
  1308. Xnewsgroup variables when there is nothing specified in the newsgroup 
  1309. Xentry of the configuration file. Only applicable with debugging and
  1310. Xif a verbose status is requested.
  1311. X.IP "-n newsgroup"
  1312. XThis restricts the execution to just the newsgroup indicated. The newsgroup
  1313. Xneeds to be specified in a "comp.sources.unix" format. Only one newsgroup 
  1314. Xcan be processed in this manner.  If this option is not specified, then all 
  1315. Xnewsgroups specified in the rkive configuration file are processed. 
  1316. X.IP "-s" 
  1317. XPrint a quick status of the sources that currently reside
  1318. Xwithin the USENET newsgroup directories for newsgroups 
  1319. Xspecified in the rkive configuration file. The status 
  1320. Xdisplays whether an article has been archived or if it is 
  1321. Xstill waiting to be archived. If it has been archived, the 
  1322. Xarchived location is displayed.
  1323. X.IP "-t"
  1324. XTest only, no archiving is done. Print a report of all
  1325. Xactions that would take place if it was called without the 
  1326. Xtest flag.  (-v assumed)
  1327. X.IP "-u"
  1328. XUnconditionally archive the articles. Normally the software 
  1329. Xwill not overwrite an archive member if a file exists with
  1330. Xthe same name as the destination archived article. The use 
  1331. Xof this option ignores the check and overwrites an existing
  1332. Xarchive member. 
  1333. X.IP "-v"
  1334. XVerbose. Prints a file by file account of the actions.
  1335. X.IP "-V"
  1336. XPrint the version number and patchlevel of the current executable.
  1337. X.LP
  1338. X.SH FILES
  1339. X/usr/local/lib/rkive.cf
  1340. X.archived
  1341. X.patchlog
  1342. X.SH "SEE ALSO"
  1343. Xarticle(1), rkive.cf(5), ckconfig(1)
  1344. X.SH BUGS
  1345. XNone known.
  1346. END_OF_FILE
  1347. if test 4927 -ne `wc -c <'rkive.1'`; then
  1348.     echo shar: \"'rkive.1'\" unpacked with wrong size!
  1349. fi
  1350. # end of 'rkive.1'
  1351. fi
  1352. if test -f 'str.c' -a "${1}" != "-c" ; then 
  1353.   echo shar: Will not clobber existing file \"'str.c'\"
  1354. else
  1355. echo shar: Extracting \"'str.c'\" \(2587 characters\)
  1356. sed "s/^X//" >'str.c' <<'END_OF_FILE'
  1357. X/*
  1358. X**
  1359. X** This software is Copyright (c) 1989 by Kent Landfield.
  1360. X**
  1361. X** Permission is hereby granted to copy, distribute or otherwise 
  1362. X** use any part of this package as long as you do not try to make 
  1363. X** money from it or pretend that you wrote it.  This copyright 
  1364. X** notice must be maintained in any copy made.
  1365. X**
  1366. X**
  1367. X**  History:
  1368. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  1369. X**                                                               
  1370. X*/
  1371. X#ifndef lint
  1372. Xstatic char SID[] = "@(#)str.c    1.1 6/1/89";
  1373. X#endif
  1374. X
  1375. X/*
  1376. X** Strchr() and Strrchr() are included for portability sake only.
  1377. X*/
  1378. X
  1379. X#ifndef NULL
  1380. X#define NULL 0
  1381. X#endif
  1382. X
  1383. X#ifndef lint
  1384. X/*
  1385. X** strchr:
  1386. X**
  1387. X** strchr(str, c) returns a pointer to the first place in
  1388. X** str where c occurs, or NULL if c does not occur in str.
  1389. X**
  1390. X** char *strchr(str, c) char *str, c; { return (str); }
  1391. X**
  1392. X*/
  1393. X
  1394. Xchar *strchr(str, c)
  1395. Xregister char *str, c;
  1396. X{
  1397. X    for (;;) {
  1398. X        if (*str == c)
  1399. X            return (str);
  1400. X        if (!*str++)
  1401. X            return (NULL);
  1402. X    }
  1403. X}
  1404. X
  1405. X/*
  1406. X** strrchr:
  1407. X**
  1408. X** strrchr(str, c) returns a pointer to the last place in 
  1409. X** str where c occurs, or NULL if c does not occur in str.
  1410. X**
  1411. X** char *strrchr(str, c) char *str, c; { return (str); }
  1412. X*/
  1413. X
  1414. Xchar *strrchr(str, c)
  1415. Xregister char *str, c;
  1416. X{
  1417. X    register char *t;
  1418. X
  1419. X    t = NULL;
  1420. X    do {
  1421. X        if (*str == c)
  1422. X            t = str;
  1423. X    } while (*str++);
  1424. X    return(t);
  1425. X}
  1426. X#endif /* lint */
  1427. X
  1428. X/*
  1429. X** strstrip:
  1430. X**
  1431. X** strstrip(str) returns a pointer to the first non-blank character 
  1432. X** in str. It strips all blanks, and tabs from the front and back
  1433. X** of a string as well as strip off newlines from the rear.
  1434. X**
  1435. X** char *strstrip(str) char *str; { return (str); }
  1436. X*/
  1437. X
  1438. Xchar *strstrip(str)
  1439. Xregister char *str;
  1440. X{
  1441. X    register char *cp, *dp;
  1442. X    
  1443. X    cp = str;
  1444. X    dp = ((str+strlen(str))-1);
  1445. X
  1446. X    while(*cp && (*cp == ' ' || *cp == '\t')) 
  1447. X      cp++;
  1448. X
  1449. X    while(dp != cp && (*dp == ' ' || *dp == '\t' || *dp == '\n'))
  1450. X      --dp;
  1451. X    *(dp+1) = '\0';
  1452. X
  1453. X    return(cp);
  1454. X}
  1455. X
  1456. X/*
  1457. X** substr:
  1458. X**
  1459. X** substr(str, substr) returns a pointer to the first place in
  1460. X** str where the substring substr occurs, or NULL if substr does
  1461. X** not occur in str.
  1462. X**
  1463. X** char *substr(str, substr) char *str, *substr; { return (str); }
  1464. X*/
  1465. Xchar *substr(from, find)
  1466. X    char *from, *find;
  1467. X{
  1468. X    register char *sp, *np;
  1469. X    register int len;
  1470. X    char *strchr();
  1471. X
  1472. X    np = from;
  1473. X    len = strlen(find);
  1474. X
  1475. X    while ((sp = strchr(np,*find)) != NULL) {
  1476. X        if (strlen(sp) < len)
  1477. X            break;
  1478. X        if (strncmp(sp,find,len) == 0) 
  1479. X            return(sp);
  1480. X        np = sp + 1;
  1481. X    }
  1482. X    return(NULL);
  1483. X}
  1484. END_OF_FILE
  1485. if test 2587 -ne `wc -c <'str.c'`; then
  1486.     echo shar: \"'str.c'\" unpacked with wrong size!
  1487. fi
  1488. # end of 'str.c'
  1489. fi
  1490. if test -f 't.cf' -a "${1}" != "-c" ; then 
  1491.   echo shar: Will not clobber existing file \"'t.cf'\"
  1492. else
  1493. echo shar: Extracting \"'t.cf'\" \(957 characters\)
  1494. sed "s/^X//" >'t.cf' <<'END_OF_FILE'
  1495. X#
  1496. X#    @(#)t.cf    1.1 6/1/89
  1497. X#
  1498. X#    Test rkive configuration file.
  1499. X#
  1500. X######################################################################
  1501. X#                      GLOBAL PARAMETERS                             #
  1502. X######################################################################
  1503. XSPOOLDIR=/usr/spool/news      
  1504. XPROBLEMS=/usenet/problems
  1505. XTYPE= Volume-Issue
  1506. XPATCHES= Package
  1507. XMAIL=kent
  1508. XOWNER=src
  1509. XGROUP=archive
  1510. XMODE=0444
  1511. X#LOG=/usenet/test.log
  1512. X#LOG_FORMAT= "%a %T" 
  1513. X#INDEX= /usenet/test.index
  1514. X#INDEX_FORMAT= "%B %a %T" 
  1515. X#COMPRESS=/usr/lbin/compress
  1516. X
  1517. X######################################################################
  1518. X#                     NEWSGROUP PARAMETERS                           #
  1519. X######################################################################
  1520. X$$comp.sources.test        
  1521. X    BASEDIR: /usenet/test 
  1522. X    TYPE: Archive-Name
  1523. X    PATCHES: Package
  1524. X    LOG: /usenet/test/log
  1525. X        INDEX: /usenet/test/index
  1526. X        INDEX_FORMAT: "%B %a %T" 
  1527. X#    COMPRESS=/usr/lbin/compress
  1528. END_OF_FILE
  1529. if test 957 -ne `wc -c <'t.cf'`; then
  1530.     echo shar: \"'t.cf'\" unpacked with wrong size!
  1531. fi
  1532. # end of 't.cf'
  1533. fi
  1534. if test -f 'version.c' -a "${1}" != "-c" ; then 
  1535.   echo shar: Will not clobber existing file \"'version.c'\"
  1536. else
  1537. echo shar: Extracting \"'version.c'\" \(712 characters\)
  1538. sed "s/^X//" >'version.c' <<'END_OF_FILE'
  1539. X/*
  1540. X**
  1541. X** This software is Copyright (c) 1989 by Kent Landfield.
  1542. X**
  1543. X** Permission is hereby granted to copy, distribute or otherwise 
  1544. X** use any part of this package as long as you do not try to make 
  1545. X** money from it or pretend that you wrote it.  This copyright 
  1546. X** notice must be maintained in any copy made.
  1547. X**
  1548. X**
  1549. X**  History:
  1550. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  1551. X**                                                               
  1552. X*/
  1553. X#ifndef lint
  1554. Xstatic char SID[] = "@(#)version.c    1.1 6/1/89";
  1555. X#endif
  1556. X
  1557. X#include <stdio.h>
  1558. X#include "patchlevel.h"
  1559. X
  1560. Xextern char sccsid[];
  1561. X
  1562. Xversion()
  1563. X{
  1564. X    void exit();
  1565. X
  1566. X    (void) fprintf(stderr,"%s\nPatch level: %d\n", sccsid, PATCHLEVEL);
  1567. X    exit(0);
  1568. X}
  1569. END_OF_FILE
  1570. if test 712 -ne `wc -c <'version.c'`; then
  1571.     echo shar: \"'version.c'\" unpacked with wrong size!
  1572. fi
  1573. # end of 'version.c'
  1574. fi
  1575. echo shar: End of archive 1 \(of 4\).
  1576. cp /dev/null ark1isdone
  1577. MISSING=""
  1578. for I in 1 2 3 4 ; do
  1579.     if test ! -f ark${I}isdone ; then
  1580.     MISSING="${MISSING} ${I}"
  1581.     fi
  1582. done
  1583. if test "${MISSING}" = "" ; then
  1584.     echo You have unpacked all 4 archives.
  1585.     rm -f ark[1-9]isdone
  1586. else
  1587.     echo You still need to unpack the following archives:
  1588.     echo "        " ${MISSING}
  1589. fi
  1590. ##  End of shell archive.
  1591. exit 0
  1592.  
  1593.